package cn.fl.spl.service.impl;

import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.spl.service.ISplActivityRecService;
import cn.fl.spl.transform.SplActivityRecVOTransform;
import cn.fl.spl.vo.SplActivityRecVO;
import fl.spl.facade.spl.api.ISplActivityRecApiService;
import fl.spl.facade.spl.condition.SplActivityRecQC;
import fl.spl.facade.spl.dto.SplActivityRecDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 商家活动记录表 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class SplActivityRecServiceImpl implements ISplActivityRecService {

	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private ISplActivityRecApiService splActivityRecApiService;

	@Override
	public SplActivityRecVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return null;
		}
		//TODO 业务逻辑
		SplActivityRecDTO dto = null;//this.自定义ApiService.selectById(id);
		return SplActivityRecVOTransform.toVO(dto);
	}

	@Override
	public Long add(SplActivityRecVO entity) throws BaseException{
		if(null == entity){
			return null;
		}
		//return this.splActivityRecApiService.add(SplActivityRecVOTransform.toDTO(entity));
		//TODO 业务逻辑
		return null;
	}

	@Override
	public boolean removeById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return false;
		}
		//return this.splActivityRecApiService.removeById(id);
		//TODO 业务逻辑
		return false;
	}
	
	/**
     * 删除
     * @param ids
     * @return
     */
	@Override
    public boolean removeByIds(List<Long> ids)throws BaseException{
    	if(CollectionUtils.isEmpty(ids)){
			return false;
		};
		return false;
    }

	@Override
	public boolean modify(SplActivityRecVO entity) throws BaseException{
		if(null == entity){
			return false;
		}
		//return this.splActivityRecApiService.modify(SplActivityRecVOTransform.toDTO(entity));
		//TODO 业务逻辑
		return false;
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
		if(null == page){
			page = new Pager();
		}
		if (null == page.getCondition()) {
			SplActivityRecQC splActivityRecQC = new SplActivityRecQC();
			page.setCondition(splActivityRecQC);
		}
		return this.splActivityRecApiService.searchListPage(page);
	}

	@Override
	public List<SplActivityRecVO> searchList(SplActivityRecQC condition) throws BaseException {
		if (null == condition) {
			return null;
		}
		return SplActivityRecVOTransform.toVOList(this.splActivityRecApiService.searchList(condition));
	}
}
